#include<iostream>
using namespace std;
int n;
int main()
{
	int t;
	cin >> t;
	while (t--) {
		cin >> n;
		long long ans = 0;
		int k = 1;
		for (int i = 1; i <= n; i++) {
			ans += k;
			k += 2;
			ans %= 10000;
		}
		cout << ans % 10000 << endl;

	}
	return 0;
}